<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>轮播图</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            transition: 1s;
        }
        #outer{
            width: 480px;
            height: 270px;
            margin: 50px auto;
            background-color: aquamarine;
            padding: 10px 0;
            overflow: hidden;  
        }
        img{
            width: 480px;
	        height: 270px;
        }
        #imgList{
            /* 去除项目符号 */
            list-style: none;
            /* 设置ul 宽度 */
            width: 2400px;
            /* 设置浮动 */
            display: flex;
            /* 开启定位 */
            position:relative;
            left:0px;
        }
    </style>
</head>
<body>
    <!-- 创建一个div，来作为大的容器 -->
    <div id="outer">
        <ul id="imgList">
            <li><img src="images2/01.jpg"></li>
            <li><img src="images2/02.jpg"></li>
            <li><img src="images2/03.jpg"></li>
            <li><img src="images2/04.jpg"></li>
            <li><img src="images2/05.jpg"></li>
        </ul>
    </div>
</body>
</html>
<script>
    // 获取id 为 imgList的 ul
    var imgList = document.getElementById("imgList");
    var count = 0;
    setInterval(function(){
        count -=480;
        if(count == -2400){
            count = 0;
        }
        imgList.style.left = count+"px";
        return false;
    },2000);
</script>